@use "@styles/mixins/bem" as *;
@use "@styles/mixins/function" as *;
@use "@styles/mixins/namespace" as *;
@use "@styles/common/var" as *;

@include b(banner-card) {
  position: relative;
  padding: 0 2rem;
  overflow: hidden;
  color: #ffffff;
  border-radius: calc(cssVar(radius) + 2px) !important;

  @include e(content) {
    position: relative;
    z-index: 1;
  }

  @include e(header) {
    display: flex;
    flex-direction: column;
  }

  @include e(title) {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
  }

  @include e(subtitle) {
    position: relative;
    z-index: 10;
    margin: 0 0 1.5rem;
    font-size: 0.9rem;
    opacity: 0.9;
  }

  @include e(button) {
    box-sizing: border-box;
    display: inline-block;
    min-width: 80px;
    height: cssVarEl(component-height);
    padding: 0 12px;
    font-size: 14px;
    line-height: cssVarEl(component-height);
    text-align: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s;

    &:hover {
      opacity: 0.8;
    }
  }

  @include e(background-image) {
    position: absolute;
    top: 50%;
    right: 0;
    z-index: 0;
    width: 12rem;
    transform: translateY(-50%);
  }

  @include has(decoration) {
    &::after {
      position: absolute;
      right: -10%;
      bottom: -20%;
      width: 60%;
      height: 150%;
      content: "";
      background: rgb(255 255 255 / 10%);
      border-radius: 40%;
      transform: rotate(-20deg);
    }
  }

  @include e(meteors) {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;

    .meteor {
      position: absolute;
      width: 2px;
      height: 60px;
      background: linear-gradient(to top, rgb(255 255 255 / 40%), rgb(255 255 255 / 10%), transparent);
      opacity: 0;
      transform-origin: top left;
      animation-name: meteor-fall;
      animation-timing-function: linear;
      animation-iteration-count: infinite;

      &::before {
        position: absolute;
        right: 0;
        bottom: 0;
        width: 2px;
        height: 2px;
        content: "";
        background: rgb(255 255 255 / 50%);
      }
    }
  }
}

@keyframes meteor-fall {
  0% {
    opacity: 1;
    transform: translate(0, -60px) rotate(-45deg);
  }

  100% {
    opacity: 0;
    transform: translate(400px, 340px) rotate(-45deg);
  }
}

@media (max-width: $device-phone) {
  @include b(banner-card) {
    box-sizing: border-box;
    justify-content: flex-start;
    padding: 16px;

    @include e(title) {
      font-size: 1.4rem;
    }

    @include e(background-image) {
      display: none;
    }

    @include has(decoration) {
      &::after {
        display: none;
      }
    }
  }
}
